/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.mobx=e()}}(function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a",e):2===arguments.length&&"function"==typeof t?$(e,t):1===arguments.length&&"string"==typeof e?i(e):i(t).apply(null,arguments)}function i(e){return function(t,n,r){return r&&"function"==typeof r.value?(r.value=$(e,r.value),r.enumerable=!1,r.configurable=!0,r):Dt(e).apply(this,arguments)}}function o(e,t,n){var r="string"==typeof e?e:e.name||"",i="function"==typeof e?e:t,o="function"==typeof e?t:n;return dt("function"==typeof i,"`runInAction` expects a function"),dt(0===i.length,"`runInAction` expects a function without arguments"),dt("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),U(r,i,o,void 0)}function a(e){return"function"==typeof e&&e.isMobxAction===!0}function s(e,t,n){function r(){o(u)}var i,o,s;"string"==typeof e?(i=e,o=t,s=n):"function"==typeof e&&(i=e.name||"Autorun@"+ht(),o=e,s=t),Be(o,"autorun methods cannot have modifiers"),dt("function"==typeof o,"autorun expects a function"),dt(a(o)===!1,"Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action."),s&&(o=o.bind(s));var u=new Wt(i,function(){this.track(r)});return u.schedule(),u.getDisposer()}function u(e,t,n,r){var i,o,a,u;"string"==typeof e?(i=e,o=t,a=n,u=r):"function"==typeof e&&(i="When@"+ht(),o=e,a=t,u=n);var c=s(i,function(e){if(o.call(u)){e.dispose();var t=Z();a.call(u),ee(t)}});return c}function c(e,t,n){return vt("`autorunUntil` is deprecated, please use `when`."),u.apply(null,arguments)}function l(e,t,n,r){function i(){s(f)}var o,s,u,c;"string"==typeof e?(o=e,s=t,u=n,c=r):"function"==typeof e&&(o=e.name||"AutorunAsync@"+ht(),s=e,u=t,c=n),dt(a(s)===!1,"Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action."),void 0===u&&(u=1),c&&(s=s.bind(c));var l=!1,f=new Wt(o,function(){l||(l=!0,setTimeout(function(){l=!1,f.isDisposed||f.track(i)},u))});return f.schedule(),f.getDisposer()}function f(e,t,n,i,o,a){function s(){if(!x.isDisposed){var e=!1;x.track(function(){var t=b(x);e=_t(y,w,t),w=t}),m&&f&&l(w,x),m||e!==!0||l(w,x),m&&(m=!1)}}var u,c,l,f,p,h;"string"==typeof e?(u=e,c=t,l=n,f=i,p=o,h=a):(u=e.name||t.name||"Reaction@"+ht(),c=e,l=t,f=n,p=i,h=o),void 0===f&&(f=!1),void 0===p&&(p=0);var d=Me(c,Yt.Reference),v=d[0],b=d[1],y=v===Yt.Structure;h&&(b=b.bind(h),l=r(u,l.bind(h)));var m=!0,g=!1,w=void 0,x=new Wt(u,function(){p<1?s():g||(g=!0,setTimeout(function(){g=!1,s()},p))});return x.schedule(),x.getDisposer()}function p(e,t,n,r){return"function"==typeof e&&arguments.length<3?"function"==typeof t?h(e,t,void 0):h(e,void 0,t):Pt.apply(null,arguments)}function h(e,t,n){var r=Me(e,Yt.Recursive),i=r[0],o=r[1];return new zt(o,n,i===Yt.Structure,o.name,t)}function d(e,t){dt("function"==typeof e&&1===e.length,"createTransformer expects a function that accepts one argument");var n={},r=Jt.resetId,i=function(r){function i(t,n){r.call(this,function(){return e(n)},null,!1,"Transformer-"+e.name+"-"+t,void 0),this.sourceIdentifier=t,this.sourceObject=n}return Ct(i,r),i.prototype.onBecomeUnobserved=function(){var e=this.value;r.prototype.onBecomeUnobserved.call(this),delete n[this.sourceIdentifier],t&&t(e,this.sourceObject)},i}(zt);return function(e){r!==Jt.resetId&&(n={},r=Jt.resetId);var t=v(e),o=n[t];return o?o.get():(o=n[t]=new i(t,e),o.get())}}function v(e){if(null===e||"object"!=typeof e)throw new Error("[mobx] transform expected some kind of object, got: "+e);var t=e.$transformId;return void 0===t&&(t=ht(),At(e,"$transformId",t)),t}function b(e,t){return J()||console.warn("[mobx.expr] 'expr' should only be used inside other reactive functions."),p(e,t).get()}function y(e){for(var t=[],n=1;n=2,"extendObservable expected 2 or more arguments"),dt("object"==typeof e,"extendObservable expects an object as first argument"),dt(!un(e),"extendObservable should not be used on maps, use map.merge instead"),t.forEach(function(t){dt("object"==typeof t,"all arguments of extendObservable should be objects"),dt(!k(t),"extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540"),m(e,t,Yt.Recursive,null)}),e}function m(e,t,n,r){var i=Xe(e,r,n);for(var o in t)if(Ot(t,o)){if(e===t&&!kt(e,o))continue;var a=Object.getOwnPropertyDescriptor(t,o);qe(i,o,a)}return e}function g(e,t){return w(rt(e,t))}function w(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=yt(e.observing).map(w)),t}function x(e,t){return _(rt(e,t))}function _(e){var t={name:e.name};return ie(e)&&(t.observers=oe(e).map(_)),t}function O(e,t,n){return"function"==typeof n?A(e,t,n):S(e,t)}function S(e,t){return wt(e)&&!nt(e)?(vt("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),it(I(e)).intercept(t)):it(e).intercept(t)}function A(e,t,n){return wt(e)&&!nt(e)?(vt("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),y(e,{property:e[t]}),A(e,t,n)):it(e,t).intercept(n)}function R(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(nt(e)===!1)return!1;var n=rt(e,t);return Ft(n)}return Ft(e)}function k(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(We(e)||un(e))throw new Error("[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");if(nt(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return!!e.$mobx||Nt(e)||Xt(e)||Ft(e)}function T(e,t,n){return dt(arguments.length>=2&&arguments.length<=3,"Illegal decorator config",t),Tt(e,t),dt(!n||!n.get,"@observable can not be used on getters, use @computed instead"),Vt.apply(null,arguments)}function I(e,t){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return T.apply(null,arguments);if(dt(arguments.length<3,"observable expects zero, one or two arguments"),k(e))return e;var n=Me(e,Yt.Recursive),r=n[0],i=n[1],o=r===Yt.Reference?Mt.Reference:j(i);switch(o){case Mt.Array:case Mt.PlainObject:return Ue(i,r);case Mt.Reference:case Mt.ComplexObject:return new dn(i,r);case Mt.ComplexFunction:throw new Error("[mobx.observable] To be able to make a function reactive it should not have arguments. If you need an observable reference to a function, use `observable(asReference(f))`");case Mt.ViewFunction:return vt("Use `computed(expr)` instead of `observable(expr)`"),p(e,t)}dt(!1,"Illegal State")}function j(e){return null===e||void 0===e?Mt.Reference:"function"==typeof e?e.length?Mt.ComplexFunction:Mt.ViewFunction:Lt(e)?Mt.Array:"object"==typeof e?wt(e)?Mt.PlainObject:Mt.ComplexObject:Mt.Reference}function E(e,t,n,r){return"function"==typeof n?C(e,t,n,r):L(e,t,n)}function L(e,t,n){return wt(e)&&!nt(e)?(vt("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),it(I(e)).observe(t,n)):it(e).observe(t,n)}function C(e,t,n,r){return wt(e)&&!nt(e)?(vt("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),y(e,{property:e[t]}),C(e,t,n,r)):it(e,t).observe(n,r)}function D(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=null),e instanceof Date||e instanceof RegExp)return e;if(t&&null===n&&(n=[]),t&&null!==e&&"object"==typeof e)for(var i=0,o=n.length;i0,"actions should have valid names, got: '"+e+"'");var n=function(){return U(e,t,this,arguments)};return n.isMobxAction=!0,n}function U(e,t,n,r){dt(!Ft(Jt.trackingDerivation),"Computed values or transformers should not invoke actions or trigger other side effects");var i,o=be();if(o){i=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var u=0;u0}function oe(e){return e.observers}function ae(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function se(e,t){if(1===e.observers.length)e.observers.length=0,ue(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function ue(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Jt.pendingUnobservations.push(e))}function ce(){Jt.inBatch++}function le(){if(1===Jt.inBatch){for(var e=Jt.pendingUnobservations,t=0;t0)){Jt.isRunningReactions=!0;for(var e=Jt.pendingReactions,t=0;e.length>0;){if(++t===Ht)throw re(),new Error("Reaction doesn't converge to a stable state after "+Ht+" iterations. Probably there is a cycle in the reactive function: "+e[0]);for(var n=e.splice(0),r=0,i=n.length;r0}function Re(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),bt(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function ke(e,t){for(var n=Z(),r=e.interceptors,i=0,o=r.length;i0}function Ie(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),bt(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function je(e,t){var n=Z(),r=e.changeListeners;if(r){r=r.slice();for(var i=0,o=r.length;i=this.length,value:tt?" (... and "+(e.length-t)+"more)":"")}function gt(e){return null!==e&&"object"==typeof e}function wt(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function xt(){for(var e=arguments[0],t=1,n=arguments.length;t=0;r--)if(!jt(e[r],t[r]))return!1;return!0}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(It(e).length!==It(t).length)return!1;for(var i in e){if(!(i in t))return!1;if(!jt(e[i],t[i]))return!1}return!0}return e===t}function Et(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return gt(e)&&e[n]===!0}}function Lt(e){return Array.isArray(e)||We(e)}var Ct=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};ne(),n.extras={allowStateChanges:z,getAtom:rt,getDebugName:ot,getDependencyTree:g,getObserverTree:x,isComputingDerivation:J,isSpyEnabled:be,resetGlobalState:re,spyReport:ye,spyReportEnd:ge,spyReportStart:me,trackTransitions:xe},n._={getAdministration:it,resetGlobalState:re},"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx(t.exports);var Dt=at(function(e,t,n,i,o){var a=i&&1===i.length?i[0]:n.name||t||"",s=r(a,n);At(e,t,s)},function(e){return this[e]},function(){dt(!1,"It is not allowed to assign new values to @action fields")},!1,!0);n.action=r,n.runInAction=o,n.isAction=a,n.autorun=s,n.when=u,n.autorunUntil=c,n.autorunAsync=l,n.reaction=f;var Pt=at(function(e,t,n,r,i){dt("undefined"!=typeof i,"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.");var o=i.get,a=i.set;dt("function"==typeof o,"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'");var s=!1;r&&1===r.length&&r[0].asStructure===!0&&(s=!0);var u=Xe(e,void 0,Yt.Recursive);Ye(u,t,s?De(o):o,!1,a)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){this.$mobx.values[e].set(t)},!1,!0);n.computed=p,n.createTransformer=d,n.expr=b,n.extendObservable=y,n.intercept=O,n.isComputed=R,n.isObservable=k;var Vt=at(function(e,t,n){var r=F(!0);"function"==typeof n&&(n=Ce(n));var i=Xe(e,void 0,Yt.Recursive);Ye(i,t,n,!0,void 0),G(r)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){et(this,e,t)},!0,!1);n.observable=I;var Mt;!function(e){e[e.Reference=0]="Reference",e[e.PlainObject=1]="PlainObject",e[e.ComplexObject=2]="ComplexObject",e[e.Array=3]="Array",e[e.ViewFunction=4]="ViewFunction",e[e.ComplexFunction=5]="ComplexFunction"}(Mt||(Mt={})),n.observe=E,n.toJS=D,n.toJSON=P,n.whyRun=M,n.useStrict=B,n.isStrictModeEnabled=N;var $t=function(){function e(e){void 0===e&&(e="Atom@"+ht()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Bt.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){fe(this)},e.prototype.reportChanged=function(){Oe("propagatingAtomChange",null,!1),pe(this),Se(!1)},e.prototype.toString=function(){return this.name},e}();n.BaseAtom=$t;var Ut=function(e){function t(t,n,r){void 0===t&&(t="Atom@"+ht()),void 0===n&&(n=wn),void 0===r&&(r=wn),e.call(this,t),this.name=t,this.onBecomeObservedHandler=n,this.onBecomeUnobservedHandler=r,this.isPendingUnobservation=!1,this.isBeingTracked=!1}return Ct(t,e),t.prototype.reportObserved=function(){return ce(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),le(),!!Jt.trackingDerivation},t.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},t}($t);n.Atom=Ut;var Bt,Nt=Et("Atom",$t),zt=function(){function e(e,t,n,r,i){this.derivation=e,this.scope=t,this.compareStructural=n,this.dependenciesState=Bt.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Bt.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+ht(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+ht(),i&&(this.setter=$(r+"-setter",i))}return e.prototype.peek=function(){this.isComputing=!0;var e=F(!1),t=this.derivation.call(this.scope);return G(e),this.isComputing=!1,t},e.prototype.peekUntracked=function(){var e=!0;try{var t=this.peek();return e=!1,t}finally{e&&X(this)}},e.prototype.onBecomeStale=function(){de(this)},e.prototype.onBecomeUnobserved=function(){dt(this.dependenciesState!==Bt.NOT_TRACKING,"INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row"),Y(this),this.value=void 0},e.prototype.get=function(){dt(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),ce(),1===Jt.inBatch?K(this)&&(this.value=this.peekUntracked()):(fe(this),K(this)&&this.trackAndCompute()&&he(this));var e=this.value;return le(),e},e.prototype.recoverFromError=function(){this.isComputing=!1},e.prototype.set=function(e){if(this.setter){dt(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else dt(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){be()&&ye({object:this,type:"compute",fn:this.derivation,target:this.scope});var e=this.value,t=this.value=H(this,this.peek);return _t(this.compareStructural,t,e)},e.prototype.observe=function(e,t){var n=this,r=!0,i=void 0;return s(function(){var o=n.get();if(!r||t){var a=Z();e(o,i),ee(a)}r=!1,i=o})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.whyRun=function(){var e=Boolean(Jt.trackingDerivation),t=yt(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=yt(oe(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Bt.NOT_TRACKING?" * This computation is suspended (not in use by any reaction) and won't run automatically.\n\tDidn't expect this computation to be suspended at this point?\n\t 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n\t 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).\n":" * This computation will re-run if any of the following observables changes:\n "+mt(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n\tMissing items in this list?\n\t 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n\t 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n * If the outcome of this computation changes, the following observers will be re-run:\n "+mt(n)+"\n"); },e}(),Ft=Et("ComputedValue",zt);!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Bt||(Bt={})),n.IDerivationState=Bt,n.untracked=Q;var Gt=["mobxGuid","resetId","spyListeners","strictMode","runId"],Kt=function(){function e(){this.version=4,this.trackingDerivation=null,this.runId=0,this.mobxGuid=0,this.inTransaction=0,this.isRunningReactions=!1,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[]}return e}(),Jt=function(){var t=new Kt;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");return e.__mobxGlobal?e.__mobxGlobal:e.__mobxGlobal=t}(),Wt=function(){function e(e,t){void 0===e&&(e="Reaction@"+ht()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=Bt.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+ht(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Jt.pendingReactions.push(this),ce(),ve(),le())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(this._isScheduled=!1,K(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&be()&&ye({object:this,type:"scheduled-reaction"})))},e.prototype.track=function(e){ce();var t,n=be();n&&(t=Date.now(),me({object:this,type:"reaction",fn:e})),this._isRunning=!0,H(this,e),this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Y(this),n&&ge({time:Date.now()-t}),le()},e.prototype.recoverFromError=function(){this._isRunning=!1,this._isTrackPending=!1},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(ce(),Y(this),le()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=yt(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+mt(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\tMissing items in this list?\n\t 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n\t 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n"},e}();n.Reaction=Wt;var Ht=100,Xt=Et("Reaction",Wt),qt={spyReportEnd:!0};n.spy=we,n.transaction=_e;var Yt;!function(e){e[e.Recursive=0]="Recursive",e[e.Reference=1]="Reference",e[e.Structure=2]="Structure",e[e.Flat=3]="Flat"}(Yt||(Yt={})),n.asReference=Ce,Ce.mobxModifier=Yt.Reference,n.asStructure=De,De.mobxModifier=Yt.Structure,n.asFlat=Pe,Pe.mobxModifier=Yt.Flat,n.asMap=Ve;var Qt=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Zt=0,en=function(){function e(){}return e}();en.prototype=[];var tn=function(){function e(e,t,n,r){this.mode=t,this.array=n,this.owned=r,this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new $t(e||"ObservableArray@"+ht())}return e.prototype.makeReactiveArrayItem=function(e){return Be(e,"Array values cannot have modifiers"),this.mode===Yt.Flat||this.mode===Yt.Reference?e:Ue(e,this.mode,this.atom.name+"[..]")},e.prototype.intercept=function(e){return Re(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Ie(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;e!==t&&(e>t?this.spliceWithArray(t,0,new Array(e-t)):this.spliceWithArray(e,t-e))},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?");this.lastKnownLength+=t,t>0&&e+t+1>Zt&&Ge(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){W();var r=this.values.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:void 0===t||null===t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=[]),Ae(this)){var i=ke(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!i)return mn;t=i.removedCount,n=i.added}n=n.map(this.makeReactiveArrayItem,this);var o=n.length-t;this.updateArrayLength(r,o);var a=(s=this.values).splice.apply(s,[e,t].concat(n));return 0===t&&0===n.length||this.notifyArraySplice(e,n,a),a;var s},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&be(),i=Te(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&me(o),this.atom.reportChanged(),i&&je(this,o),r&&ge()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&be(),i=Te(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&me(o),this.atom.reportChanged(),i&&je(this,o),r&&ge()},e}(),nn=function(e){function t(t,n,r,i){void 0===i&&(i=!1),e.call(this);var o=new tn(r,n,this,i);Rt(this,"$mobx",o),t&&t.length?(o.updateArrayLength(0,t.length),o.values=t.map(o.makeReactiveArrayItem,o),o.notifyArraySplice(0,o.values.slice(),mn)):o.values=[],Qt&&Object.defineProperty(o.array,"0",rn)}return Ct(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.toString=function(){return"[mobx.array] "+Array.prototype.toString.apply(this.$mobx.values,arguments)},t.prototype.toLocaleString=function(){return"[mobx.array] "+Array.prototype.toLocaleString.apply(this.$mobx.values,arguments)},t}(en);pt(nn.prototype,function(){return ft(this.slice())}),St(nn.prototype,["constructor","intercept","observe","clear","concat","replace","toJS","toJSON","peek","find","splice","push","pop","shift","unshift","reverse","sort","remove","toString","toLocaleString"]),Object.defineProperty(nn.prototype,"length",{enumerable:!1,configurable:!0,get:function(){return this.$mobx.getArrayLength()},set:function(e){this.$mobx.setArrayLength(e)}}),["every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some"].forEach(function(e){var t=Array.prototype[e];dt("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),At(nn.prototype,e,function(){return this.$mobx.atom.reportObserved(),t.apply(this.$mobx.values,arguments)})});var rn={configurable:!0,enumerable:!1,set:ze(0),get:Fe(0)};Ge(1e3),n.fastArray=Je;var on=Et("ObservableArrayAdministration",tn);n.isObservableArray=We;var an={},sn=function(){function e(e,t){var n=this;this.$mobx=an,this._data={},this._hasMap={},this.name="ObservableMap@"+ht(),this._keys=new nn(null,Yt.Reference,this.name+".keys()",(!0)),this.interceptors=null,this.changeListeners=null,this._valueMode=$e(t),this._valueMode===Yt.Flat&&(this._valueMode=Yt.Reference),z(!0,function(){wt(e)?n.merge(e):Array.isArray(e)&&e.forEach(function(e){var t=e[0],r=e[1];return n.set(t,r)})})}return e.prototype._has=function(e){return"undefined"!=typeof this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(Be(t,"[mobx.map.set] Expected unwrapped value to be inserted to key '"+e+"'. If you need to use modifiers pass them as second argument to the constructor"),Ae(this)){var r=ke(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!r)return;t=r.newValue}n?this._updateValue(e,t):this._addValue(e,t)},e.prototype.delete=function(e){var t=this;if(this.assertValidKey(e),e=""+e,Ae(this)){var n=ke(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var r=be(),i=Te(this),n=i||r?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return r&&me(n),_e(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1);var n=t._data[e];n.setNewValue(void 0),t._data[e]=void 0},void 0,!1),i&&je(this,n),r&&ge(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new dn(t,Yt.Reference,this.name+"."+e+"?",(!1)),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if(t=n.prepareNewValue(t),t!==hn){var r=be(),i=Te(this),o=i||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&me(o),n.setNewValue(t),i&&je(this,o),r&&ge()}},e.prototype._addValue=function(e,t){var n=this;_e(function(){var r=n._data[e]=new dn(t,n._valueMode,n.name+"."+e,(!1));t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)},void 0,!1);var r=be(),i=Te(this),o=i||r?{type:"add",object:this,name:e,newValue:t}:null;r&&me(o),i&&je(this,o),r&&ge()},e.prototype.get=function(e){if(e=""+e,this.has(e))return this._data[e].get()},e.prototype.keys=function(){return ft(this._keys.slice())},e.prototype.values=function(){return ft(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return ft(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(r){return e.call(t,n.get(r),r)})},e.prototype.merge=function(e){var t=this;return _e(function(){un(e)?e.keys().forEach(function(n){return t.set(n,e.get(n))}):Object.keys(e).forEach(function(n){return t.set(n,e[n])})},void 0,!1),this},e.prototype.clear=function(){var e=this;_e(function(){Q(function(){e.keys().forEach(e.delete,e)})},void 0,!1)},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJs=function(){return vt("toJs is deprecated, use toJS instead"),this.toJS()},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"'")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return dt(t!==!0,"`observe` doesn't support the fire immediately property for observable maps."),Ie(this,e)},e.prototype.intercept=function(e){return Re(this,e)},e}();n.ObservableMap=sn,pt(sn.prototype,function(){return this.entries()}),n.map=He;var un=Et("ObservableMap",sn);n.isObservableMap=un;var cn=function(){function e(e,t,n){this.target=e,this.name=t,this.mode=n,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return dt(t!==!0,"`observe` doesn't support the fire immediately property for observable objects."),Ie(this,e)},e.prototype.intercept=function(e){return Re(this,e)},e}(),ln={},fn={},pn=Et("ObservableObjectAdministration",cn);n.isObservableObject=nt;var hn={},dn=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableValue@"+ht()),void 0===i&&(i=!0),e.call(this,r),this.mode=n,this.hasUnreportedChange=!1,this.value=void 0;var o=Me(t,Yt.Recursive),a=o[0],s=o[1];this.mode===Yt.Recursive&&(this.mode=a),this.value=Ue(s,this.mode,this.name),i&&be()&&ye({type:"create",object:this,newValue:this.value})}return Ct(t,e),t.prototype.set=function(e){var t=this.value;if(e=this.prepareNewValue(e),e!==hn){var n=be();n&&me({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&ge()}},t.prototype.prepareNewValue=function(e){if(Be(e,"Modifiers cannot be used on non-initial values."),W(),Ae(this)){var t=ke(this,{object:this,type:"update",newValue:e});if(!t)return hn;e=t.newValue}var n=_t(this.mode===Yt.Structure,this.value,e);return n?Ue(e,this.mode,this.name):hn},t.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),Te(this)&&je(this,[e,t])},t.prototype.get=function(){return this.reportObserved(),this.value},t.prototype.intercept=function(e){return Re(this,e)},t.prototype.observe=function(e,t){return t&&e(this.value,void 0),Ie(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t}($t),vn=Et("ObservableValue",dn),bn="__$$iterating",yn=function(){function e(){this.listeners=[],vt("extras.SimpleEventEmitter is deprecated and will be removed in the next major release")}return e.prototype.emit=function(){for(var e=this.listeners.slice(),t=0,n=e.length;t